﻿// ==========================================================
// File: Universal.WebAPI.Core.IBaseClient.cs
// Created: 14.12.2014
// Created By: Tim cadenbach
// 
// Copyright (C) 2014 Tim Cadenbach
// License: Apache License 2.0
// ==========================================================
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Universal.WebAPI.Generic;
using Universal.WebAPI.Response;

namespace Universal.WebAPI.Interfaces
{
  /// <summary>
  /// The RestClient interface.
  /// </summary>
  public interface IBaseClient
  {
    /// <summary>
    /// Gets or sets timeout
    /// </summary>
    TimeSpan Timeout { get; set; }

    /// <summary>
    /// Gets the base address.
    /// </summary>
    Uri BaseAddress { get; }

    /// <summary>
    /// Add request header.
    /// </summary>
    /// <param name="key">
    /// The key.
    /// </param>
    /// <param name="value">
    /// The value.
    /// </param>
    void AddHeader(string key, string value);

    /// <summary>
    /// Remove Key from request header.
    /// </summary>
    /// <param name="key">
    /// The key.
    /// </param>
    void RemoveHeader(string key);

    /// <summary>
    /// Async POST method.
    /// </summary>
    /// <returns>The async task.</returns>
    /// <param name="endpoint">Address of the service.</param>
    /// <param name="dto">DTO to post.</param>
    /// <param name="format">Format of the request.</param>
    /// <typeparam name="T">The type of object to be returned.</typeparam>
    Task<ServiceResponse<T>> PostAsync<T>(string endpoint, object dto, RequestFormat format);

    /// <summary>
    /// Async GET method
    /// </summary>
    /// <returns>The async task with .</returns>
    /// <param name="endpoint">Address of the service.</param>
    /// <param name="format">Format of the request.</param>
    /// <typeparam name="T">The type of object to be returned.</typeparam>
    Task<ServiceResponse<T>> GetAsync<T>(string endpoint, RequestFormat format);
    Task<ServiceResponse<T>> GetAsync<T>(string endpoint, Dictionary<string, string> values, RequestFormat format);


  }
}
